/**
 * Created by admin on 2017/9/26.
 */
define(['app', 'filters/filters'],function(app){
    app.register.controller('compaliVideo', function ($scope, $Ajax, $state, $stateParams, $sce,$rootScope) {
        $rootScope.states=1;
        var http = app._baseUrl;
        $scope.public_id = $stateParams.public_id;
        $scope.aliyun_video_id = $stateParams.aliyun_video_id;
        $scope.play = {
            aliyun_video_id:$scope.aliyun_video_id,
            VideoId:'',
            PlayAuth:'',
            title:'',
            player:{},
            request:function(){
                var url = http + '/Qy/Curriculum/getVideoPlayAuth&aliyun_video_id='+this.aliyun_video_id;
                $Ajax.get(url).then(function(res){
                    if(res.data.success){
                        $scope.play.VideoId = res.data.data.VideoMeta.VideoId;
                        $scope.play.PlayAuth = res.data.data.PlayAuth;
                        $scope.play.title = res.data.data.VideoMeta.Title;
                        $scope.play.showVideo();
                    }
                });
            },
            showVideo:function(){
                var player = new prismplayer({
                    id: "J_prismPlayer", // 容器id
                    vid : this.VideoId,//媒体转码服务的媒体Id
                    playauth : this.PlayAuth,
                    width: "1020px",
                    height:"625px",
                    autoplay: true,
                    isLive:false,
                    playsinline:true,
                    controlBarVisibility:"always",
                    showBuffer:false,
                    useH5Prism:true,
                    useFlashPrism:true,
                    cover:""
                });
                this.player = player;

            }
        };
        $scope.play.request();

    })
});